Repository navigation
Conversation
…n the web UI and over MCP
As buggregator/server 2.14 does, Trap takes a POST with `application/csp-report` or `application/reports+json` on any path, or any POST to `/csp` and `/csp/{project}`, reads both formats into one report shape and answers 204. The CSP reports page of the web UI shows them, the console prints a block per report, and the MCP event tools list, filter (`report_type`, `directive`, `blocked`, `disposition`, `page`, `source_file`) and read them. A request marked for another module is left to it; a body over 1 MiB gets 413, one that is no report 400. `trap test` sends a report of each format.
Chrome delivers Reporting API reports to another origin only after a CORS preflight, so an OPTIONS to `/csp` paths is answered for any origin; it is not an origin check. docs/csp.md and the skill's csp reference set up a Report-Only policy for plain PHP, Laravel and Symfony.
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #382 +/- ##
==========================================
+ Coverage 80.55% 80.78% +0.23%
==========================================
Files 432 441 +9
Lines 17488 17813 +325
==========================================
+ Hits 14087 14390 +303
- Misses 3401 3423 +22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…t type
fix(csp): escape the project in the console header
feat(csp): show the failure of `network-error` and the reason of `crash` reports
docs(csp): name the project of browser reports in the path; Network Error Logging
As buggregator/server does, `X-Buggregator-Event: csp` or the Basic user `csp` marks a report whatever its path and type; the header goes before the Basic user. A project with markup, such as `/csp/%3Cerror%3Ered`, made the console print nothing. A browser sends no userinfo credentials and adds no headers to a report, so the docs and the skill name the project in `/csp/{project}` and leave Basic and `X-Buggregator-Project` to proxies and other clients.
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔍 What was changed
POSTwithapplication/csp-reportorapplication/reports+jsonon any path, or anyPOSTto/cspand/csp/{project}. Both formats become one report shape; areport-tobatch of several reports (csp-violation, deprecation, intervention, crash…) is onecspevent.type: csp, fieldsreport_type,directive,blocked,disposition,page,source_file, and aget_eventtext with the page, directive, blocked resource, disposition, source line and sample. No dedicated tool: the event tools read well enough.trap testsends a report of each format. New docs/csp.md with recipes for plain PHP,Reporting-Endpoints, Laravel and Symfony; thetrapskill gets acsp.mdreference with a fix-the-policy recipe for agents.How it works
{project}of the path, else the password of the Basic usercsp, elseX-Buggregator-Project. A request withX-Buggregator-Eventor a Basic user of another type is left to its module.204with an empty body,400for a body that is no report,413above 1 MiB. The CSP module sits after the other sources and before the HTTP dump, so it takes nothing of theirs.Review notes
OPTIONS /csp[/…]gets a preflight answer for any origin. It checks nothing, but it is a CORS answer: say if you would rather leavereport-toto same-origin endpoints.Reporting-Endpointsworks only from an HTTPS page to anhttps://endpoint; tohttp://127.0.0.1nothing is sent.report-uriworks from HTTP and HTTPS pages tohttp://127.0.0.1. The docs say so.{http_port}with the port of the page, so with the UI on a port of its own it points at the UI port, which takes no reports. That is the same for every hint of the UI and is already in docs/web-ui.md.Checklist
report-uriandreport-toagainst a running Trap; the CSP reports page, its detail pages and the setup hint checked in the UI;list_eventsandget_eventover MCPDocumentation